from typing import List


class Solution:

    def compare(self,a,b):
        return int(str(a)+str(b))>int(str(b)+str(a))

    def minNumber(self, nums: List[int]) -> str:
        for i in range(len(nums)-1):
            for j in range(i+1,len(nums)):
                if self.compare(nums[i],nums[j]):
                    temp=nums[i]
                    nums[i]=nums[j]
                    nums[j]=temp
        nums=[str(i) for i in nums]
        ans=''.join(nums)
        return ans

if __name__ == '__main__':
    s=Solution()
    nums=[3, 30, 34, 5, 9]
    x=s.minNumber(nums)
    print(x)
